#include <stdio.h>
#include <iostream>

using namespace std;

int main(int argc, char const *argv[])
{
    int n, i, j, *results, temp;
    cin >> n;
    results = new int[n];
    for (i = 0; i < n; i++)
    {
        results[i] = 0;
        for (j = 0; j < n; j++)
        {
            cin >> temp;
            results[i] |= temp;
        }
    }
    for (i = 0; i < n; i++)
    {
        if (i) cout << " ";
        cout << results[i];
    }
    
    return 0;
}
